package com.example.sppmode.DataAccess;

import android.content.Context;
import android.content.SharedPreferences;

import com.example.sppmode.Common.MyApplication;

public class MyData {

    private final int MY_DB_VERSION = 2;

    private final String TAG = "MyData";
    private final String MY_SP_NAME = "my_sp_data";
    private final String MY_DB_NAME = "my_db_data.db";


    private static MyData instance = null;
    private SharedPreferences mySP = null;
    private MyDBHelper myDBHelper = null;

    private MyData() {
        MyApplication application = MyApplication.getInstance();
        if (application != null) {
            Context context = application.getApplicationContext();
            mySP = application.getSharedPreferences(MY_SP_NAME, Context.MODE_PRIVATE);
            myDBHelper = new MyDBHelper(context, MY_DB_NAME, null, 1);
        }
    }

    public static MyData getInstance() {
        if (instance == null) {
            instance = new MyData();
        }

        return instance;
    }

    public SharedPreferences getMySP() {
        return mySP;
    }

    public MyDBHelper getMyDBHelper() {
        return myDBHelper;
    }


}
